// 从函数中返回Point结构

#include <iostream>
using namespace std;

struct Point {
    double x;
    double y;
};

Point AverageTwoPoints(Point first, Point second);

int main() {
    Point first, second;

    cout << "请输入第一个点的坐标: ";
    cin >> first.x >> first.y;

    cout << "请输入第二个点的坐标: ";
    cin >> second.x >> second.y;

    Point average = AverageTwoPoints(first, second);
    cout << "中点坐标为 (" << average.x
            << ", " << average.y << ")\n";
}

Point AverageTwoPoints(Point first, Point second) {
    Point temp;
    temp.x = (first.x + second.x) / 2.0;
    temp.y = (first.y + second.y) / 2.0;
    return temp;
}